﻿package mortal.game.view.group.cellRenderer
{
    import Message.Public.*;
    import com.greensock.layout.*;
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class GroupInviteCellRenderer extends GCellRenderer
    {
        private var _sGroupOper:SGroupOper;
        private var _teamName:GTextFiled;
        private var _formPlayer:GTextFiled;
        private var _career:GTextFiled;
        private var _level:GTextFiled;
        private var _guildName:GTextFiled;
        private var _power:GTextFiled;
        private var _operBtn:GButton;

        public function GroupInviteCellRenderer()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            var _loc_1:* = GlobalStyle.textFormatBai;
            _loc_1.align = AlignMode.CENTER;
            this._teamName = UIFactory.gTextField("", -22, 0, 160, 20, this, _loc_1, true);
            this._formPlayer = UIFactory.gTextField("", 147, 0, 100, 20, this, GlobalStyle.textFormatAnjin);
            this._career = UIFactory.gTextField("", 223, 0, 100, 20, this, _loc_1);
            this._level = UIFactory.gTextField("", 319, 0, 100, 20, this, _loc_1);
            this._guildName = UIFactory.gTextField("", 438, 0, 100, 20, this);
            this._power = UIFactory.gTextField("", 557, 0, 100, 20, this, GlobalStyle.textFormatChen);
            this._operBtn = UIFactory.gButton(Language.getString(30228), 652, -1, 71, 22, this);
            this._operBtn.configEventListener(MouseEvent.CLICK, this.inviteHandler);
            this.pushUIToDisposeVec(UIFactory.bg(0, 25, 760, 1, this, ImagesConst.SplitLine));
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._teamName.dispose(param1);
            this._formPlayer.dispose(param1);
            this._career.dispose(param1);
            this._level.dispose(param1);
            this._guildName.dispose(param1);
            this._power.dispose(param1);
            this._operBtn.dispose(param1);
            this._teamName = null;
            this._formPlayer = null;
            this._career = null;
            this._level = null;
            this._guildName = null;
            this._power = null;
            this._operBtn = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function inviteHandler(event:MouseEvent) : void
        {
            var _loc_2:* = new Array();
            var _loc_3:* = new SGroupOper();
            _loc_3.fromEntityId = Cache.instance.role.entityInfo.entityId;
            _loc_3.toEntityId = this._sGroupOper.fromEntityId;
            _loc_3.fromPlayer = new SPublicPlayer();
            _loc_3.fromPlayer.entityId = Cache.instance.role.entityInfo.entityId;
            _loc_3.type = EGroupOperType._EGroupOperTypeAgree;
            _loc_3.uid = this._sGroupOper.uid;
            _loc_3.fromPlayer.guildId = new SEntityId();
            _loc_3.fromPlayer.copyId = new SEntityId();
            _loc_2.push(_loc_3);
            Dispatcher.dispatchEvent(new DataEvent(EventName.GroupInviteReplyOper, _loc_2));
            return;
        }// end function

        private function setCareer(param1:int) : void
        {
            this._career.text = GameDefConfig.instance.getCarrer(param1);
            return;
        }// end function

        private function setCamp(param1:int) : void
        {
            this._guildName.text = this._sGroupOper.fromPlayer.guildName ? (this._sGroupOper.fromPlayer.guildName) : (Language.getString(35301));
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._sGroupOper = param1.data;
            if (this._sGroupOper)
            {
                this.setCareer(this._sGroupOper.fromPlayer.career);
                this.setCamp(this._sGroupOper.fromPlayer.camp);
                this._formPlayer.text = this._sGroupOper.fromPlayer.name;
                this._level.text = this._sGroupOper.fromPlayer.level.toString();
                this._power.text = this._sGroupOper.fromPlayer.combat.toString();
                if (this._sGroupOper.groupName == "")
                {
                    this._teamName.htmlText = this._sGroupOper.fromPlayer.name + "(<font color=\'#df2121\'>" + this._sGroupOper.memberNum + "</font>/5)";
                }
                else
                {
                    this._teamName.htmlText = this._sGroupOper.groupName + "(<font color=\'#df2121\'>" + this._sGroupOper.memberNum + "</font>/5)";
                }
            }
            return;
        }// end function

    }
}
